{extend name="web/public/base" /}
{block name="header"}
{/block}
{block name="main"}
<section class="scrollable padder">
    <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
        <li><a><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">财务中心</li>
        <li class="active">{$title}</li>
    </ul>
    <div class="row">
        <div class="col-sm-12">
            <section class="panel panel-default">
                <header class="panel-heading"> {$title}</header>
                {include file="web/public/search" /}
                {notempty name="_list"}
                <div class="table-responsive">
                    <table class="table table-striped table-hover b-t b-light text-sm">
                        <thead>
                        <tr>
                            <th>会员账号</th><th>抽奖时间</th><th>奖品</th>
                            <th>发奖时间</th><th>状态</th><th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name='_list' id='vo'}
                        <tr>
                            <td>{$vo.uid|getInfo="usernumber",###}[{$vo.uid|getInfo="realname",###}]</td>
                            <td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
                            <td>{$rewards[$vo['type']]}</td>
                            <td>
                                {eq name="vo.status" value="0"}尚未发奖{/eq}
                                {eq name="vo.status" value="1"}{$vo.handle_time|date="Y-m-d H:i:s",###}{/eq}
                            </td>
                            <td>
                                {eq name="vo.status" value="0"}尚未发奖{/eq}
                                {eq name="vo.status" value="1"}已发奖{/eq}
                            </td>
                            <td>
                                {if condition="$vo.status eq 0 "}
                                <a class='btn btn-mini btn-danger'  href="javascript:void(0);" onclick="agree({$vo['id']})">发奖</a>
                                {else/}无
                                {/if}
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                <footer class="panel-footer">
                    <div class="row">
                        <div class="text-right text-center-xs">
                            {$page}
                        </div>
                    </div>
                </footer>
                {else/}
                <div style="text-align: center">
                    <image src="__PUBLIC__/images/empty.jpg"></image>
                </div>

                {/notempty}
            </section>
        </div>
    </div>
</section>
{/block}
{block name="script"}
<script type="text/javascript">
    function agree(id){
        layer.confirm('确定要发奖吗？', function(){
            var index = layer.load('正在跳转，请耐心等待');
            $.post("{:url('rewardAgree')}",{id:id}, function (data) {
                layer.close(index);
                layer.msg(data.msg);
                location.reload();
            }, "json");
            return false;
        });
    }
</script>
{/block}
{block name="footer"}
{/block}